package cn.gz.ibix.ibix_library.account.adapter;

import android.net.Uri;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

import cn.gz.ibix.ibix_library.R;
import cn.gz.ibix.ibix_library.account.bean.Account;
import lombok.Getter;

/**
 * 项目名称：android_tool
 * <br>类描述：
 * <br>创建人：htliu
 * <br>创建时间：2019/7/10 14:49
 * <br>修改人:
 * <br>修改时间：2019/7/10 14:49
 * <br>修改备注：
 * <br>@version
 */
public class AccountAdapter extends BaseAdapter {
    public static final String basePic = "http://carpics.oss-cn-shanghai.aliyuncs.com/";
    @Getter
    private List<Account> list = new ArrayList<>();

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup group) {
        view = LayoutInflater.from(group.getContext()).inflate(R.layout.item, group, false);
        ImageView imageView = (ImageView) view.findViewById(R.id.iv);
        TextView textView = (TextView) view.findViewById(R.id.tv);
        Account account = list.get(i);
        imageView.setImageURI(Uri.parse(basePic + account.getAvatar()));
        textView.setText(account.getName() + "   " + account.getNickName());
        return view;

    }
}
